@isTest

private class test_CSEducation_Trigger {
    
    static testMethod void testNationalCSEducationTrigger() {
         String rtid;
         RecordType rt=new recordtype();
         rt=[select id from recordtype where sobjectType=:'consumereducation__c' and name=:'全国消费者教育']; 
        rtid=rt.id;
        rtid=rtid.substring(0,15);
        Profile p  = [select id from profile where name=: 'System Administrator'];       
        
         User u3 =new User (alias = 'new', email = 'shlia@isoftstone.com', emailencodingkey='UTF-8', lastname = 'Testing', languagelocalekey = 'en_US', localesidkey='en_US', profileid = p.id, timezonesidkey = 'Asia/Shanghai', username='new3@testorg1.com');
        insert u3;
        User u2 =new User (alias = 'new', email = 'shlia@isoftstone.com', emailencodingkey='UTF-8', lastname = 'Testing', languagelocalekey = 'en_US', localesidkey='en_US', profileid = p.id, timezonesidkey = 'Asia/Shanghai', username='new@testorg1.com',managerid=u3.id);
        insert u2;
        User u1 =new User (alias = 'standt', email = 'shlia@isoftstone.com', emailencodingkey='UTF-8', lastname = 'Testing', languagelocalekey = 'en_US', localesidkey='en_US', profileid = p.id,timezonesidkey = 'Asia/Shanghai', username='standarduser@testorg1.com',managerid=u2.id);
        insert u1;
        
        system.runas(u1){
          consumereducation__c csedu=new consumereducation__c(name='全国活动',Date__c=date.today()+2,recordtypeid=rtid,ifnonhospital__c='sdfa');
          insert csedu;
    
         
          update csedu;
          csedu.date__c=date.today()+2;
          update csedu;
         
        }
        }
        
         static testMethod void testPclassTrigger() {
         String rtid;
         RecordType rt=new recordtype();
         rt=[select id from recordtype where sobjectType=:'consumereducation__c' and name=:'妈妈班']; 
        rtid=rt.id;
        rtid=rtid.substring(0,15);
        Profile p  = [select id from profile where name=: 'System Administrator'];       
        
        User u1 =new User (alias = 'standt', email = 'shlia@isoftstone.com', emailencodingkey='UTF-8', lastname = 'Testing', languagelocalekey = 'en_US', localesidkey='en_US', profileid = p.id, timezonesidkey = 'Asia/Shanghai', username='standarduser@testorg1.com');
        insert u1;
        
        system.runas(u1){
          consumereducation__c csedu=new consumereducation__c(name='妈妈班',Date__c=date.today()+8,recordtypeid=rtid,ifnonhospital__c='sdfa');
          insert csedu;
          update csedu;
          delete csedu;
        }
        }
        static testMethod void testLocalCSEducationTrigger() {
         String rtid;
         RecordType rt=new recordtype();
         rt=[select id from recordtype where sobjectType=:'consumereducation__c' and name=:'本地消费者教育']; 
        rtid=rt.id;
        rtid=rtid.substring(0,15);
        Profile p  = [select id from profile where name=: 'System Administrator'];       
        User u1 =new User (alias = 'standt', email = 'shlia@isoftstone.com', emailencodingkey='UTF-8', lastname = 'Testing', languagelocalekey = 'en_US', localesidkey='en_US', profileid = p.id, timezonesidkey = 'Asia/Shanghai', username='standarduser@testorg1.com');
        insert u1;
        
        system.runas(u1){
          consumereducation__c csedu=new consumereducation__c(name='本地消费者教育',Date__c=date.today()+2,recordtypeid=rtid,ifnonhospital__c='sdfa');
          insert csedu;
          update csedu;
    
        }
     




    }   
    
}